home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 5.5 KB | 199 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWIconSh.cpp
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef FWICONSH_H
- #include "FWIconSh.h"
- #endif
-
- #ifndef FWGC_H
- #include "FWGC.h"
- #endif
-
- #ifndef FWRASTER_H
- #include "FWRaster.h"
- #endif
-
- // ----- Foundation Includes -----
-
- #ifndef FWSTREAM_H
- #include "FWStream.h"
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- #ifdef FW_BUILD_MAC
- #pragma segment FWGraphx_IconShape
- #endif
-
- FW_DEFINE_CLASS_M1(FW_CIconShape, FW_CBoundedShape)
- FW_REGISTER_ARCHIVABLE_CLASS(FW_LIconShape, FW_CIconShape, FW_CIconShape::Read, FW_CShape::Write)
-
- //========================================================================================
- // class FW_CIconShape
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::FW_CIconShape
- //----------------------------------------------------------------------------------------
-
- FW_CIconShape::FW_CIconShape(const FW_PIcon& Icon,
- const FW_CRect& rect,
- FW_RenderIconOptions options) :
- FW_CBoundedShape(rect, FW_kFrame, FW_kNormalInk, FW_kNormalStyle, FW_kNormalFont),
- fIcon(Icon),
- fOptions(options)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::FW_CIconShape
- //----------------------------------------------------------------------------------------
-
- FW_CIconShape::FW_CIconShape(const FW_CIconShape& other) :
- FW_CBoundedShape(other),
- fIcon(other.fIcon),
- fOptions(other.fOptions)
- {
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::FW_CIconShape
- //----------------------------------------------------------------------------------------
-
- FW_CIconShape::FW_CIconShape(FW_CReadableStream& archive) :
- FW_CBoundedShape(archive)
- {
- archive >> fIcon;
- archive >> fOptions;
-
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::~FW_CIconShape
- //----------------------------------------------------------------------------------------
-
- FW_CIconShape::~FW_CIconShape()
- {
- FW_START_DESTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::operator=
- //----------------------------------------------------------------------------------------
-
- FW_CIconShape& FW_CIconShape::operator=(const FW_CIconShape& other)
- {
- FW_CBoundedShape::operator=(other);
-
- fIcon = other.fIcon;
- fOptions = other.fOptions;
-
- return *this;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::Render
- //----------------------------------------------------------------------------------------
-
- void FW_CIconShape::Render(FW_CGraphicContext& gc) const
- {
- gc.GetRasterizer()->RenderIcon(
- gc,
- fIcon,
- fRect,
- fOptions,
- GetRenderVerb());
- }
-
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::Copy
- //----------------------------------------------------------------------------------------
-
- FW_CShape* FW_CIconShape::Copy() const
- {
- return FW_NEW(FW_CIconShape, (*this));
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::Flatten
- //----------------------------------------------------------------------------------------
-
- void FW_CIconShape::Flatten(FW_CWritableStream& archive) const
- {
- FW_CBoundedShape::Flatten(archive);
-
- archive << fIcon;
- archive << fOptions;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::RenderIcon
- //----------------------------------------------------------------------------------------
-
- void FW_CIconShape::RenderIcon(FW_CGraphicContext& gc,
- const FW_PIcon& icon,
- const FW_CRect& rect,
- FW_RenderIconOptions options)
- {
- gc.GetRasterizer()->RenderIcon(
- gc,
- icon,
- rect,
- options,
- FW_kFill);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::Read
- //----------------------------------------------------------------------------------------
-
- void* FW_CIconShape::Read(FW_CReadableStream& archive)
- {
- return FW_NEW(FW_CIconShape, (archive));
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::GetGeometry
- //----------------------------------------------------------------------------------------
-
- void FW_CIconShape::GetGeometry(FW_PIcon& icon,
- FW_RenderIconOptions options,
- FW_CRect& bounds) const
- {
- icon = fIcon;
- options = fOptions;
- bounds = fRect;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CIconShape::SetGeometry
- //----------------------------------------------------------------------------------------
-
- void FW_CIconShape::SetGeometry(const FW_PIcon& icon,
- FW_RenderIconOptions options,
- const FW_CRect& bounds)
- {
- fIcon = icon;
- fOptions = options;
- fRect = bounds;
- }
-
-